<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/******************************************************
* Profile			: article 
* Author			: 乔伟
* Create Time		: 2011-10-05 
* Modify Time		: 2011-10-05 
* Modify Profile	:  
******************************************************/
class guest_book extends Front_Controller {
	
	/******************************************************
	* Profile			: 显示
	* Author			: 韩腾飞
	* Create Time		: 2011-10-05 
	* Modify Time		: 2012-06-05 
	* Modify Author		: 宁秀娟
	* Modify Profile	: 增加操作成功提示
	******************************************************/
	public function show($id = null)
	{
        // $this->load->model('user_manager');
        // $this->load->model('article_manager');
        // $this->load->model('article_class_manager');
        $this->load->model('menu_manager');
        // $this->load->model('link_manager');
        // $this->load->model('template_manager');
         $this->load->model('guest_book_manager');
        // $this->load->model('page_manager');
        // $this->load->model('page_class_manager');
        // $this->load->model('link_class_manager');
        // $this->load->model('usergroup_manager');

		$tmp=array();
		if($this->is_postback())
		{
			$this->load->library('form_validation');
			if ($this->form_validation->run('guest_book') == TRUE)
			{
                // exit("bb");
				$guest_book = $this->filter_post();
				$guest_book['create_time'] = Date('Y-m-d H:i');
				// print_r($guest_book);exit;
				$this->guest_book_manager->insert($guest_book);
				$tmp["success"]="true";
			}
            // exit("aa");
		} 
		$this->load->view('front/guest_book/v_show',$tmp);
	}
	
	function contacter_mobilephone_check($str)
	{
		// die("abc");
		if(!preg_match("/^1[3|5|8][0-9][0-9]{8}$/i",$str))
		{
			$this->form_validation->set_message('contacter_mobilephone_check', '手机号码格式不正确 13812345678');
			return false;
		}
		else
		{
			return true; 
		}
		
	}
	
}
